<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>条件指令-v-if/v-else-if/v-else</title>
</head>
<body>

<div id="app">
    <p v-if="gender == 2">保密</p>
    <span></span>
    <p v-if="gender == 1">男</p>
    <span></span>
    <p v-if="gender == 0">女</p>

    <hr>

    <p v-if="gender == 0">女</p>
    <p v-else-if="gender == 1">男</p>
    <p v-else>保密</p>
</div>

<script src="js/vue.global.js"></script>
<script>
    var vm = Vue.createApp({
        data() {
            return {
                gender: 0 // 0 女 1 男
            }
        }
    }).mount("#app");
</script>

</body>
</html>